package Model;

import Impl.FlyBehaviorImpl;
import Impl.Target;

import java.util.zip.CheckedOutputStream;

public class Duck implements Target {
    private FlyBehaviorImpl flyBehavior;
    private String state;

    public Duck() {
        this.state = "alive";
    }

    public void getState() {
        System.out.println( "my life state is: "+ state);
    }

    public void getShot(String state) {
        if(this.state == "died"){
            System.out.println("this duck is already dead");
        }
        else
            this.state = "died";
    }

    // add reborn function
    public void reborn(){
        if(this.state == "alive"){
            System.out.println("this duck is still alive");
        }
        else
            this.state = "alive";
    }

    public void setFlyBehavior(FlyBehaviorImpl flyBehavior) {
        this.flyBehavior = flyBehavior;
    }

    public void display(){
        System.out.println("i am a duck");
    }
    public void swim(){
        System.out.println("i am swimming");
    }
    public void performFly(){
        flyBehavior.fly();
    }
}
